package com.gxa.travelphone.mq;

import com.gxa.travelphone.config.SmsConfig;
import entity.Member;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@RocketMQMessageListener(consumerGroup = "login-service",topic = "phone-code")
@Slf4j
public class ConsumerMQ implements RocketMQListener<String> {

    @Resource
    private SmsConfig smsConfig;

    @Override
    public void onMessage(String phone) {
        smsConfig.sendSms(phone);
        log.info("消费了{}",phone);
    }

}
